#include <bits/stdc++.h>
using namespace std;

#define LL long long

const int N = 1e5 + 5;

char A[N], B[N];

int cnt[300];

int main() {
#ifndef __SKT__
    freopen("concatenation.in", "r", stdin);
    freopen("concatenation.out", "w", stdout);
#endif
    while(scanf("%s%s", A, B) != EOF) {
        memset(cnt, 0, sizeof(cnt));
        int len_b = strlen(B);
        for(int i = 0; i < len_b - 1; ++i) {
            ++cnt[B[i]];
        }
        int len_a = strlen(A);
        LL ans = 0;
        for(int i = len_a - 1; i >= 0; --i) {
            if(i == len_a - 1) {
                ans += len_b;
            } else {
                ans += len_b - cnt[A[i + 1]];
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

